Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Converting QuickDraw GX Data to QuickTime Vectors

The GX-to-vector transcoder included with QuickTime lets you convert QuickDraw GX data into equivalent QuickTime vectors. If your application already has QuickDraw GX data, or if you use a drawing program that can create QuickDraw GX data, the transcoder makes it easy to create vector graphics for your application.

Note
To use the GX-to-vector transcoder, either QuickDraw GX or the GX Graphics extension must be installed on the computer.

The GX-to-vector transcoder converts all QuickDraw GX data, including all fill, ink, and stroke options, into QuickTime vectors that can be processed by the QuickTime vector codec. The transcoder converts bitmaps, which are not supported by QuickTime, into rectangles. If the GX data includes transfer modes, the minimum bit depth of the resulting vector output is 16.

Listing 7 shows how to use the transcoder to convert a QuickDraw GX shape into a handle containing a QuickTime vector data stream.

Listing 7 Converting QuickDraw GX data to QuickTime vectors

static Handle GXShapeToCurveData(Handle shapeData)
                                    // input: shape data, destroyed
{
    ImageDescriptionHandle      pathDesc = nil;
    ImageTranscodeSequence      ts = nil;
    OSErr           err;
    ImageDescriptionHandleidh = (ImageDescriptionHandle)NewHandle(0);
        
    // transcode this frame into a path
    err = ImageTranscodeSequenceBegin(&ts, idh, `path', &pathDesc, nil, 0);
    if (err == noErr)
        {
        void *pathData;
        long pathDataSize;

        HLock(shapeData);
        err = ImageTranscodeFrame(ts, *shapeData, GetHandleSize(shapeData),
            &pathData, &pathDataSize);
        HUnlock(shapeData);
        if (err == noErr)
            {
            SetHandleSize(shapeData, pathDataSize);
            if (MemError() == noErr)
                {
                BlockMoveData(pathData, *shapeData, pathDataSize);
                DisposeHandle((Handle)idh);
                idh = pathDesc;
                pathDesc = nil;
                }
            ImageTranscodeDisposeFrameData(ts, pathData);
            }           

        ImageTranscodeSequenceEnd(ts);
        }
        
    return(shapeData);

} // GXShapeToCurveData

© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |